var UPPERCHARCODE = new Array(65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90);
var LOWERCHARCODE = new Array(97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122);
var NUMBERCHARCODE = new Array(48,49,50,51,52,53,54,55,56,57);
var SPECIELCHARCODE = new Array(45,59,95,64,44);
var ALLOWCHARCODE = new Array(46);
// Match Integer
var ExpInteger = /^(\d)+$/;
var ExpFloat = /^(\d)+(.(\d)+)*$/;
var NumberFormat = /^(?!0.00)\d{1,3}(,\d{3})*(\.\d{1,2})?$/
var TimeSpent = /^(\d)+h[0-5]?[0-9]p?$/;  
var TimeSpentNew = /^(d{1,*}):[0-5][0-9]$/;
//Match Name
var ExpName = /^(\w)+$/;
// matches 05:04 or 12:34 but not 75:83
var ExpTime24 = /^(([0-1][0-9])|(2[0-4])):[0-5][0-9]$/;
//matches email
var ExpEmail = /^(\w)+([.](\w)+)*@(\w)+([.](\w)+)+$/;
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/;
// Match mm/yyyy
var ExpMonthYear = /^(0[1-9])|(1[0-2]){1}\/\d{4}$/;
// Match dd/mm/yyyy
var ExpDayMonthYear = /^(([1-9]|0[1-9]|([1-2][0-9])|3[0-1]))\/(([1-9])|(0[1-9])|(1[0-2]))\/\d{4}$/;
// Match dd/mm/yyyy H:i:s
var ExpFullTime = /^((0[1-9]|([1-2][0-9])|3[0-1]))\/((0[1-9])|(1[0-2]))\/\d{4} (0[0-9]|1[0-9]|2[0-4]):([0-5][0-9]):([0-5][0-9])$/;
// Match Phone number
var    ExpPhone = /^(\d)+(\d|.|-)*(\d)$/;

// Match mobi phone full
var ExpMobiPhone = /^09[0|1|3|5|8]\d{7}$/;
var ExpBillNo = /^(\w)+([.-](\w)+)*$/;

var arrReg = new Array();
    arrReg[0] = /^09\d\d\d\d\d\d\d\d$/;    //Di dong
    arrReg[1] = /^012\d\d\d\d\d\d\d\d$/;
    arrReg[2] = /^016\d\d\d\d\d\d\d\d$/;
    arrReg[36] = /^019\d\d\d\d\d\d\d\d/;
    arrReg[3] = /^04\d\d\d\d\d\d$/;                            //Ha Noi
    arrReg[4] = /^04\d\d\d\d\d\d\d$/;
    arrReg[37] = /^04\d\d\d\d\d\d\d\d$/;
    arrReg[5] = /^08\d\d\d\d\d\d$/;                            //TPHCM
    arrReg[6] = /^08\d\d\d\d\d\d\d$/;
    arrReg[36] = /^08\d\d\d\d\d\d\d\d$/;
    arrReg[7] = /^01[8|9]\d\d\d\d\d\d$/;                        //Hoa binh, Ha Giang
    arrReg[8] = /^01[8|9]\d\d\d\d\d\d\d$/;
    arrReg[9] = /^02[0|2|3|5|6|7|9]\d\d\d\d\d\d$/;            //Lao Cai, Son La, Lai Chau, Dien Bien, Lang Son, Tuyen Quang, Cao Bang, Yen Bai
    arrReg[10] = /^02[0|2|3|5|6|7|9]\d\d\d\d\d\d\d$/;
    arrReg[11] = /^03[0|1|3|4|6|7|8|9]\d\d\d\d\d\d$/;            //Ninh Binh, Hai Phong, Quang Ninh, Ha Tay, Thai Binh, Thanh Hoa, Nghe An, Ha Tinh
    arrReg[12] = /^03[0|1|3|4|6|7|8|9]\d\d\d\d\d\d\d$/;
    arrReg[13] = /^05[0|2|3|4|5|6|7|8|9]\d\d\d\d\d\d$/;        //Dac Lac, Dac Nong, Quang Binh, Quang Tri, Hue, Quang Ngai, Binh Dinh, Phu Yen, Khanh Hoa, Gia Lai
    arrReg[14] = /^05[0|2|3|4|5|6|7|8|9]\d\d\d\d\d\d\d$/;
    arrReg[15] = /^06[0|1|2|3|4|6|7|8]d\d\d\d\d\d$/;            //Kon Tum, Dong Nai, Binh Thuan, Lam Dong, Ba Ria Vung Tau, Tay Ninh, Dong Thap, Ninh Thuan
    arrReg[16] = /^06[0|1|2|3|4|6|7|8]\d\d\d\d\d\d\d$/;
    arrReg[17] = /^0613\d\d\d\d\d\d\d$/;                        //Dong Nai
    arrReg[18] = /^07[0|1|2|3|4|5|6|7|9]\d\d\d\d\d\d$/;        //Vinh Long, Can Tho, Hau Giang,Long An, Tien Giang, Tra Vinh, Ben Tre, An Giang, Kien Giang, Soc Trang
    arrReg[19] = /^07[0|1|2|3|4|5|6|7|9]\d\d\d\d\d\d\d$/;
    arrReg[20] = /^021[0|1]\d\d\d\d\d\d$/;                    //Phu Tho, Vinh Phuc
    arrReg[21] = /^021[0|1]\d\d\d\d\d\d\d$/;
    arrReg[22] = /^024[0|1]\d\d\d\d\d\d$/;                    //Bac Ninh, Bac Giang
    arrReg[23] = /^024[0|1]d\d\d\d\d\d\d$/;
    arrReg[24] = /^028[0|1]\d\d\d\d\d\d$/;                    //Thai Nguyen, Bac Can
    arrReg[25] = /^028[0|1]\d\d\d\d\d\d\d$/;
    arrReg[26] = /^32[0|1]0\d\d\d\d\d\d$/;                    //Hai Duong, Hung Yen
    arrReg[27] = /^032[0|1]\d\d\d\d\d\d\d$/;
    arrReg[28] = /^035[0|1]\d\d\d\d\d\d$/;                    //Nam Dinh, Ha Nam
    arrReg[29] = /^035[0|1]\d\d\d\d\d\d\d$/;
    arrReg[30] = /^051[0|1]\d\d\d\d\d\d$/;                    //Quang Nam, Da Nang
    arrReg[31] = /^051[0|1]\d\d\d\d\d\d\d$/;
    arrReg[32] = /^065[0|1]\d\d\d\d\d\d$/;                    //Binh Duong, Binh Phuoc
    arrReg[33] = /^065[0|1]\d\d\d\d\d\d\d$/;
    arrReg[34] = /^078[0|1]\d\d\d\d\d\d$/;                    //Ca Mau, Bac Lieu
    arrReg[35] = /^078[0|1]\d\d\d\d\d\d\d$/;
    arrReg[38] = /^[+]84\d\d\d\d\d\d\d\d\d$/;
    arrReg[39] = /^[+]84\d\d\d\d\d\d\d\d\d\d$/;
    arrReg[40] = /^[+]84\d\d\d\d\d\d\d\d\d\d\d$/;